<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>店铺搜索与发现</title>
    <script src="../static/js/echart.min.js"></script>
    <link rel="stylesheet" href="../static/css/all.min.css">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
        }

        body {
            background-color: #f5f7fa;
            color: #333;
            line-height: 1.6;
            padding-bottom: 80px;
        }

        .container {
            width: 100%;
            max-width: 1400px;
            margin: 0 auto;
            padding: 0 20px;
        }

        header {
            background: linear-gradient(135deg, #4e54c8, #8f94fb);
            color: white;
            padding: 20px 0;
            text-align: center;
            box-shadow: 0 4px 12px rgba(0,0,0,0.1);
            margin-bottom: 20px;
            width: 100%;
        }

        h1 {
            font-size: 1.8rem;
            margin-bottom: 5px;
            font-weight: 600;
        }

        .header-subtitle {
            font-size: 0.9rem;
            opacity: 0.9;
        }

        /* 筛选器区域 */
        .filters {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
            margin-bottom: 20px;
            background: white;
            padding: 15px 20px;
            border-radius: 16px;
            box-shadow: 0 5px 15px rgba(0,0,0,0.06);
        }

        .filter-btn {
            background: #f8f9ff;
            color: #4e54c8;
            border: none;
            padding: 8px 16px;
            border-radius: 20px;
            font-size: 0.9rem;
            cursor: pointer;
            transition: all 0.3s;
        }

        .filter-btn.active {
            background: #4e54c8;
            color: white;
        }

        .filter-btn:hover {
            background: #4e54c8;
            color: white;
        }

        /* 地图区域 - 大屏显示 */
        .map-section {
            background: white;
            border-radius: 16px;
            padding: 20px;
            margin-bottom: 20px;
            box-shadow: 0 5px 15px rgba(0,0,0,0.06);
            width: 100%;
            transition: all 0.4s ease;
            overflow: hidden;
        }

        .map-section.collapsed {
            height: 60px;
            cursor: pointer;
        }

        .map-section.collapsed .map-container,
        .map-section.collapsed .map-legend,
        .map-section.collapsed .location-info {
            display: none;
        }

        .map-title {
            font-size: 1.2rem;
            margin-bottom: 15px;
            color: #4e54c8;
            display: flex;
            align-items: center;
            font-weight: 600;
        }

        .map-title i {
            margin-right: 10px;
        }

        .toggle-map {
            margin-left: auto;
            background: none;
            border: none;
            color: #4e54c8;
            cursor: pointer;
            font-size: 0.9rem;
            display: flex;
            align-items: center;
        }

        .toggle-map i {
            margin-left: 5px;
            transition: transform 0.3s;
        }

        .map-section.collapsed .toggle-map i {
            transform: rotate(180deg);
        }

        .map-container {
            height: 500px; /* 增加地图高度 */
            background: #eef2ff;
            border-radius: 12px;
            position: relative;
            overflow: hidden;
            margin-bottom: 15px;
            width: 100%;
            transition: all 0.4s ease;
        }

        #shopMap {
            height: 100%;
            width: 100%;
        }

        .map-legend {
            display: flex;
            justify-content: center;
            gap: 20px;
            font-size: 0.9rem;
            color: #666;
            transition: all 0.4s ease;
            margin-bottom: 15px;
        }

        .legend-item {
            display: flex;
            align-items: center;
        }

        .legend-color {
            width: 14px;
            height: 14px;
            border-radius: 50%;
            margin-right: 8px;
        }

        .legend-current {
            background: #4e54c8;
        }

        .legend-shop {
            background: #ff6b6b;
        }

        /* 位置信息区域 */
        .location-info {
            background: #f8f9ff;
            border-radius: 12px;
            padding: 15px;
            display: flex;
            align-items: center;
            font-size: 0.9rem;
            color: #555;
            border-left: 4px solid #4e54c8;
        }

        .location-info i {
            margin-right: 10px;
            color: #4e54c8;
            font-size: 1rem;
        }

        .location-text {
            flex-grow: 1;
        }

        .location-actions {
            display: flex;
            gap: 10px;
        }

        .location-btn {
            background: white;
            border: 1px solid #4e54c8;
            color: #4e54c8;
            padding: 6px 12px;
            border-radius: 20px;
            font-size: 0.8rem;
            cursor: pointer;
            transition: all 0.3s;
        }

        .location-btn:hover {
            background: #4e54c8;
            color: white;
        }

        .loading-dots:after {
            content: '';
            animation: dots 1.5s infinite;
        }

        @keyframes dots {
            0%, 20% { content: '.'; }
            40% { content: '..'; }
            60%, 100% { content: '...'; }
        }

        /* 店铺区域 - 放在地图下方 */
        .shops-section {
            background: white;
            border-radius: 16px;
            padding: 0;
            margin-bottom: 20px;
            box-shadow: 0 5px 15px rgba(0,0,0,0.06);
            width: 100%;
            overflow: hidden;
        }

        .shops-header {
            background: white;
            border-radius: 16px 16px 0 0;
            padding: 20px;
            margin-bottom: 0;
            display: flex;
            align-items: center;
        }

        .shops-title {
            font-size: 1.2rem;
            color: #4e54c8;
            display: flex;
            align-items: center;
            font-weight: 600;
        }

        .shops-title i {
            margin-right: 10px;
        }

        .toggle-shops {
            margin-left: auto;
            background: none;
            border: none;
            color: #4e54c8;
            cursor: pointer;
            font-size: 0.9rem;
            display: flex;
            align-items: center;
        }

        .toggle-shops i {
            margin-left: 5px;
            transition: transform 0.3s;
        }

        .shops-container {
            display: grid;
            grid-template-columns: repeat(3, 1fr); /* 三列布局 */
            gap: 20px;
            padding: 20px;
            transition: all 0.4s ease;
            overflow: hidden;
        }

        .shops-container.collapsed {
            height: 0;
            padding: 0 20px;
            overflow: hidden;
        }

        .shop-card {
            background: white;
            border-radius: 16px;
            padding: 20px;
            box-shadow: 0 5px 15px rgba(0,0,0,0.06);
            transition: all 0.3s;
            border-left: 4px solid #4e54c8;
            display: flex;
            flex-direction: column;
        }

        .shop-card:hover {
            transform: translateY(-3px);
            box-shadow: 0 8px 20px rgba(0,0,0,0.1);
        }

        .shop-header {
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
            margin-bottom: 15px;
        }

        .shop-title {
            font-size: 1.1rem;
            color: #2c3e50;
            font-weight: 600;
        }

        .shop-badge {
            background: #4e54c8;
            color: white;
            padding: 4px 10px;
            border-radius: 20px;
            font-size: 0.8rem;
            font-weight: 500;
        }

        .shop-description {
            color: #666;
            margin-bottom: 20px;
            line-height: 1.5;
            font-size: 0.9rem;
            flex-grow: 1;
        }

        .shop-details-btn {
            background: #f8f9ff;
            color: #4e54c8;
            border: none;
            padding: 10px 20px;
            border-radius: 20px;
            font-size: 0.9rem;
            cursor: pointer;
            transition: all 0.3s;
            display: flex;
            align-items: center;
            margin-left: auto;
            margin-top: auto;
        }

        .shop-details-btn:hover {
            background: #4e54c8;
            color: white;
        }

        .shop-details-btn i {
            margin-left: 5px;
            font-size: 0.8rem;
            transition: transform 0.3s;
        }

        .shop-details-btn:hover i {
            transform: translateX(3px);
        }

        /* 用户信息栏 */
        .user-footer {
            background: white;
            border-radius: 16px;
            padding: 15px 20px;
            box-shadow: 0 -2px 15px rgba(0,0,0,0.06);
            position: fixed;
            bottom: 15px;
            left: 50%;
            transform: translateX(-50%);
            width: 92%;
            max-width: 1400px;
            display: flex;
            align-items: center;
            z-index: 100;
        }

        .user-avatar {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            background: linear-gradient(135deg, #4e54c8, #8f94fb);
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-weight: bold;
            font-size: 1.2rem;
            margin-right: 12px;
        }

        .user-name {
            font-weight: 500;
            color: #333;
        }

        @media (max-width: 1200px) {
            .shops-container {
                grid-template-columns: repeat(2, 1fr); /* 中等屏幕改为两列 */
            }
        }

        @media (max-width: 768px) {
            .shops-container {
                grid-template-columns: 1fr; /* 小屏幕改为一列 */
            }

            .container {
                padding: 0 15px;
            }

            h1 {
                font-size: 1.5rem;
            }

            .location-actions {
                flex-direction: column;
                gap: 5px;
            }

            .map-container {
                height: 400px; /* 小屏幕减少地图高度 */
            }
        }

        @media (max-width: 480px) {
            .map-container {
                height: 300px;
            }

            .shop-header {
                flex-direction: column;
                align-items: flex-start;
            }

            .shop-badge {
                margin-top: 8px;
            }

            .user-footer {
                width: 94%;
                padding: 12px 15px;
            }

            .map-section.collapsed {
                height: 50px;
            }

            .filters {
                padding: 10px 15px;
            }

            .filter-btn {
                padding: 6px 12px;
                font-size: 0.8rem;
            }
        }
        /* 店铺轮播图样式 */
        .shop-carousel {
            position: relative;
            height: 200px;
            border-radius: 12px 12px 0 0;
            overflow: hidden;
            margin: -20px -20px 15px -20px;
        }

        .carousel-container {
            position: relative;
            height: 100%;
            width: 100%;
        }

        .carousel-track {
            display: flex;
            height: 100%;
            transition: transform 0.5s ease;
        }

        .carousel-slide {
            flex: 0 0 100%;
            height: 100%;
            display: none;
        }

        .carousel-slide.active {
            display: block;
        }

        .carousel-slide img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }

        .no-image {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            height: 100%;
            background: #f8f9fa;
            color: #6c757d;
        }

        .no-image i {
            font-size: 48px;
            margin-bottom: 10px;
        }

        /* 轮播按钮 */
        .carousel-btn {
            position: absolute;
            top: 50%;
            transform: translateY(-50%);
            background: rgba(255, 255, 255, 0.8);
            border: none;
            border-radius: 50%;
            width: 36px;
            height: 36px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.3s;
            z-index: 10;
        }

        .carousel-btn:hover {
            background: rgba(255, 255, 255, 1);
            transform: translateY(-50%) scale(1.1);
        }

        .carousel-prev {
            left: 10px;
        }

        .carousel-next {
            right: 10px;
        }

        /* 轮播指示器 */
        .carousel-indicators {
            position: absolute;
            bottom: 10px;
            left: 0;
            right: 0;
            display: flex;
            justify-content: center;
            gap: 6px;
            z-index: 10;
        }

        .indicator {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background: rgba(255, 255, 255, 0.5);
            cursor: pointer;
            transition: all 0.3s;
        }

        .indicator.active {
            background: rgba(255, 255, 255, 1);
            transform: scale(1.2);
        }

        /* 店铺内容样式 */
        .shop-content {
            padding: 0 5px;
        }

        .shop-rating {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-bottom: 12px;
        }

        .stars {
            color: #ffc107;
            font-size: 14px;
        }

        .rating-text {
            font-weight: 600;
            color: #333;
        }

        .rating-count {
            color: #6c757d;
            font-size: 12px;
        }

        .shop-info {
            margin-bottom: 15px;
        }

        .info-item {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-bottom: 6px;
            font-size: 13px;
            color: #666;
        }

        .info-item i {
            width: 16px;
            color: #4e54c8;
        }

        /* 徽章样式 */
        .shop-badge {
            padding: 4px 10px;
            border-radius: 20px;
            font-size: 0.8rem;
            font-weight: 500;
            color: white;
        }

        .badge-current {
            background: #4e54c8;
        }

        .badge-popular {
            background: #ff6b6b;
        }

        .badge-hot {
            background: #ff922b;
        }

        .badge-new {
            background: #51cf66;
        }

        .badge-default {
            background: #6c757d;
        }

        /* 无店铺样式 */
        .no-shops {
            text-align: center;
            padding: 60px 20px;
            color: #6c757d;
        }

        .no-shops i {
            font-size: 48px;
            margin-bottom: 15px;
            display: block;
        }

        /* 响应式调整 */
        @media (max-width: 768px) {
            .shop-carousel {
                height: 160px;
            }

            .carousel-btn {
                width: 32px;
                height: 32px;
            }

            .shop-rating {
                flex-wrap: wrap;
            }
        }
    </style>
</head>
<body>
<header>
    <div class="container">
        <h1>探索附近店铺</h1>
        <div class="header-subtitle">发现城市中的小众角落</div>
    </div>
</header>

<div class="container">
    <!-- 筛选器 -->
    <div class="filters">
        <button class="filter-btn active">全部</button>
        <button class="filter-btn">餐厅</button>
        <button class="filter-btn">咖啡厅</button>
        <button class="filter-btn">购物</button>
        <button class="filter-btn">娱乐</button>
        <button class="filter-btn">景点</button>
        <button class="filter-btn">人气推荐</button>
    </div>

    <!-- 地图区域 - 大屏显示 -->
    <section class="map-section" id="mapSection">
        <div style="display: flex; align-items: center;">
            <h2 class="map-title"><i class="fas fa-map-marker-alt"></i> 全国店铺分布</h2>
            <button class="toggle-map" id="toggleMap">
                <span id="mapToggleText">收起地图</span>
                <i class="fas fa-chevron-up"></i>
            </button>
        </div>
        <div class="map-container">
            <div id="shopMap"></div>
        </div>
        <div class="map-legend">
            <div class="legend-item">
                <div class="legend-color legend-current"></div>
                <span>我的位置</span>
            </div>
            <div class="legend-item">
                <div class="legend-color legend-shop"></div>
                <span>推荐店铺</span>
            </div>
        </div>

        <!-- 位置信息区域 -->
        <div class="location-info">
            <i class="fas fa-location-arrow"></i>
            <div class="location-text">
                <span id="locationText">正在获取位置<span class="loading-dots"></span></span>
            </div>
            <div class="location-actions">
                <button class="location-btn" id="refreshLocation">刷新</button>
                <button class="location-btn" id="shareLocation">分享</button>
            </div>
        </div>
    </section>

    <!-- 店铺区域 - 放在地图下方 -->
    <section class="shops-section">
        <div class="shops-header" id="shopsHeader">
            <h2 class="shops-title"><i class="fas fa-store"></i> 推荐店铺 (12)</h2>
            <button class="toggle-shops" id="toggleShops">
                <span id="shopsToggleText">收起店铺</span>
                <i class="fas fa-chevron-up"></i>
            </button>
        </div>

        <div class="shops-container" id="shopsContainer">
            <section class="shop-card">
                <div class="shop-header">
                    <h3 class="shop-title">文艺书店</h3>
                    <span class="shop-badge">人气推荐</span>
                </div>
                <p class="shop-description">隐藏在繁华街区的安静角落，拥有丰富的图书选择和舒适的阅读环境。</p>
                <button class="shop-details-btn">查看详情 <i class="fas fa-chevron-right"></i></button>
            </section>

            <section class="shop-card">
                <div class="shop-header">
                    <h3 class="shop-title">精品咖啡馆</h3>
                    <span class="shop-badge">网红打卡</span>
                </div>
                <p class="shop-description">以手冲咖啡和精致甜点闻名，店内装修极具设计感，是拍照和休闲的绝佳场所。</p>
                <button class="shop-details-btn">查看详情 <i class="fas fa-chevron-right"></i></button>
            </section>

            <section class="shop-card">
                <div class="shop-header">
                    <h3 class="shop-title">手作工坊</h3>
                    <span class="shop-badge">新店开业</span>
                </div>
                <p class="shop-description">提供各种手工艺制作体验，包括陶艺、皮具和绘画，适合亲子活动和朋友聚会。</p>
                <button class="shop-details-btn">查看详情 <i class="fas fa-chevron-right"></i></button>
            </section>

            <section class="shop-card">
                <div class="shop-header">
                    <h3 class="shop-title">特色火锅店</h3>
                    <span class="shop-badge">必吃美食</span>
                </div>
                <p class="shop-description">提供正宗川渝火锅，汤底鲜美，食材新鲜，是冬日聚餐的最佳选择。</p>
                <button class="shop-details-btn">查看详情 <i class="fas fa-chevron-right"></i></button>
            </section>

            <section class="shop-card">
                <div class="shop-header">
                    <h3 class="shop-title">瑜伽工作室</h3>
                    <span class="shop-badge">健康生活</span>
                </div>
                <p class="shop-description">专业瑜伽教练指导，环境舒适安静，提供多种瑜伽课程和冥想工作坊。</p>
                <button class="shop-details-btn">查看详情 <i class="fas fa-chevron-right"></i></button>
            </section>

            <section class="shop-card">
                <div class="shop-header">
                    <h3 class="shop-title">复古服装店</h3>
                    <span class="shop-badge">独特风格</span>
                </div>
                <p class="shop-description">收集了各种复古风格的服装和配饰，每一件都有独特的故事和历史。</p>
                <button class="shop-details-btn">查看详情 <i class="fas fa-chevron-right"></i></button>
            </section>
        </div>
    </section>
</div>

<script src="../static/js/jquery.js"></script>
<script src="../static/js/jquery.cookie.js"></script>
<script src="../static/js/shop_recommendation.js"></script>
</body>
</html>